package com.hcj.springcloud.NullObjectPattern;

/**
 * 顾客工厂
 */
public class CustomerFactory {

    public static final String[] names = new String[]{"hcj", "missjin", "lff"};

    public static AbstractCustomer getCustomer(String name){
        for (int i = 0; i < names.length ; i++) {
            if(names[i].equalsIgnoreCase(name)){
                return new RealCustomer(name);
            }
        }
        return new NullCustomer(name);
    }
}
